home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacWorld 1999 July
/
Macworld (1999-07).dmg
/
Shareware World
/
Info
/
For Developers
/
Mops 3.4.sea
/
Mops ƒ
/
zStruct
< prev
next >
Wrap
Text File
|
1998-12-29
|
2KB
|
82 lines
(*
Most of the Struct classes are in pStruct. Here we just have a couple of
classes that we couldn't put in pStruct, since they need reloc!
*)
\ X-ARRAY can execute its elements.
:class X-ARRAY super{ array }
:m TO: ( index -- ) ^elem: super reloc! ;m
:m EXEC: ( index -- )
\ inline{ ^elem @abs execute} ;m
inline{ ^elem (ex_ra) } ;m
:m FILL: \ ( xt -- )
limit NIF drop EXIT THEN \ Out if no elements
idxbase tuck reloc! @ fill: super ;m
:m PUT: \ ( xt0 ... xt(N-1) N -- )
limit 0EXIT \ Out if no elements
false -> relocChk? \ May get used in instantiating exported objs
limit ?#xts
idxbase dup limit 1- 4* +
DO i reloc! -4 +LOOP
true -> relocChk? ;m
:m ACTIONS: \ A synonym for put:. A more appropriate name to use in
\ sub-classes such as dialogs.
put: self ;m
private
:m PrintNxts: \ ( n -- )
0 ?do i ^elem: self @abs cr .id loop ;m
public
:m PRINT: limit printNxts: self ;m
:m CLASSINIT: ['] null fill: self ;m
;class
\ X-COL is a collection of execution tokens.
:class X-COL super{ (col) x-array }
:m REMOVEXT: \ ( xt -- )
false -> relocChk? pad reloc! true -> relocChk?
pad @ indexof: self 0EXIT
remove: self ;m
:m PRINT:
get: size printNXts: self ;m
;class
: CHKKEY
cr type# 189 \ "paused - <space> to continue..."
cr \ 01Feb94 DBH Add cr. Better for TW.
(key) cr 0 -> out bl = nif cr decimal abort then ;
: ?P
sleepticks 0 -> sleepticks
?terminal
swap -> sleepticks
NIF pause EXIT THEN \ No key hit - just do default PAUSE
(key) drop chkKey ;
: P
sleepticks 0 -> sleepticks
?terminal drop
-> sleepticks ;
' p -> pause \ This will be improved when Events is loaded
' ?p -> ?pause